package com.alex.demo.springtest.service;


import com.alex.demo.springtest.bean.Employee;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service("companyService")
public class CompanyService {
    /*private List<Employee> list = new ArrayList<>();*/
    public Employee addEmployee(String e) throws Exception{
        Employee employee = new Employee();
        if ("".equals(e)||e == null) {
            throw new Exception("未传入数据");
        }
        employee.setName(e);
        System.out.println("成功运行");
        return employee;
    }
    public Employee addAge(int e) throws Exception{
        Employee employee1 = new Employee();
        String.valueOf(e);
        if("".equals(e)){
            throw new Exception("年龄输入错误");
        }
        employee1.setAge(e);
        System.out.println("输入正确");
        return employee1;
    }
   /* public Employee addSalary(double e) throws Exception{
        Employee employee = new Employee();
        String.valueOf(e);
        if("".equals(e)){
            throw new Exception("薪水格式错误！");
        }
        employee.setSalary(e);
        System.out.println("输入正确");
        return employee;
    }*/
}
